package org.dream.ui.chart.impl;

import org.dream.ui.chart.ChartModel;

/**
 * 
 * @author qiuriyuchen E-mail:panpan_001@126.com
 */
public class ChartModelImpl implements ChartModel {
	private String title;
	private int leftMargin;
	private int bottomMargin;
	private int rightMargin;
	private int topMargin;
	private int windowCount = 1;
	private int width;
	private int height;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.dream.ui.chart.Chart#getWindowCount()
	 */

	public int getWindowCount() {
		return windowCount;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.dream.ui.chart.Chart#setWindowCount(int)
	 */

	public void setWindowCount(int windowCount) {
		this.windowCount = windowCount;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.dream.ui.chart.Chart#getTitle()
	 */

	public String getTitle() {
		return title;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.dream.ui.chart.Chart#setTitle(java.lang.String)
	 */

	public void setTitle(String title) {
		this.title = title;
	}

	public int getLeftMargin() {
		return leftMargin;
	}

	public void setMargin(int leftMargin, int rightMargin, int topMargin, int bottomMargin) {
		this.leftMargin = leftMargin;
		this.rightMargin = rightMargin;
		this.topMargin = topMargin;
		this.bottomMargin = bottomMargin;
	}

	public int getBottomMargin() {
		return bottomMargin;
	}

	public int getRightMargin() {
		return rightMargin;
	}

	public int getTopMargin() {
		return topMargin;
	}

	public int getWidth() {
		return width;
	}

	public void setSize(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public int getHeight() {
		return height;
	}

	public int getPixelXLeft() {
		// TODO Auto-generated method stub
		return getLeftMargin();
	}

	public int getPixelXRight() {
		return getWidth() - rightMargin;
	}

	public int getPixelYTop() {
		// TODO Auto-generated method stub
		return getTopMargin();
	}

	public int getPixelYButtom() {
		return getHeight() - bottomMargin;
	}

	public int getUseableWidth() {
		return getPixelXRight() - getLeftMargin();

	}

	public int getUseableHeight() {
		return getPixelYButtom() - getTopMargin();

	}

}
